<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TblOaNotice> list = (List<TblOaNotice>)request.getAttribute("list");
	NoticeForm form = (NoticeForm)request.getAttribute("command");
	String isimportant = StringUtils.isNotBlank(form.getIsimportant())?form.getIsimportant():"";
	String istop = StringUtils.isNotBlank(form.getIstop())?form.getIstop():"";
	String group = StringUtils.isNotBlank(form.getGroup())?form.getGroup():"";
	String title = StringUtils.isNotBlank(form.getTitle())?form.getTitle():"";
	String viceTitle = StringUtils.isNotBlank(form.getViceTitle())?form.getViceTitle():"";
%>

<div class="userListWrap">
	<%-- 	<form id="userListForm">
        <div class="form-item">
    		<label for="userId">标题：</label>
    		<input class="inputTextSearch xs" type="text" name="title" data-options="" value="<%=title%>"/>
        </div>
        <div class="form-item form-item">
    		<a href="javascript:XF.Notice.listNoticeSearch()" class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
        </div>
    </form> --%>
    
    
    
    
    <form id="userListForm">
        <div class="form-item">
    		<label for="userId">标题:</label>
    		<input class="easyui-validatebox" type="text" name="title" data-options="" value="<%=title%>"/>
        </div>
        <div class="form-item">
    		<label for="userId">副标题:</label>
    		<input class="easyui-validatebox" type="text" name="viceTitle" data-options="" value="<%=viceTitle%>"/>
        </div>
        <input type="hidden" name="group" value="0">
        <%-- <div class="form-item">
    		<label for="deptId">公告类型:</label>
			<select name="group" form="enabled">
				<option value="">全部</option>
				<option value="0" <%=group.equalsIgnoreCase("0")?"selected=selected":""%>>内部公告</option>
				<option value="1" <%=group.equalsIgnoreCase("1")?"selected=selected":""%>>营运日报</option>
			</select>    		
        </div> --%>
        
<%--        	<div class="form-item">
    		<label for="deptId">是否置顶:</label>
			<select name="istop" form="enabled">
				<option value="">全部</option>
				<option value="0" <%=istop.equalsIgnoreCase("0")?"selected=selected":""%>>不置顶</option>
				<option value="1" <%=istop.equalsIgnoreCase("1")?"selected=selected":""%>>置顶</option>
			</select>    		
        </div>
        
        <div class="form-item">
    		<label for="deptId">是否重要:</label>
			<select name=isimportant form="enabled">
				<option value="">全部</option>
				<option value="0" <%=isimportant.equalsIgnoreCase("0")?"selected=selected":""%>>不重要</option>
				<option value="1" <%=isimportant.equalsIgnoreCase("1")?"selected=selected":""%>>重要</option>
			</select>    		
        </div> --%>

		<!--<div class="form-item form-item-two">
    		<label for="deptId">创建时间:</label>
    		<input id="createDateBegin" name="createDateBegin" type="text" class="easyui-datebox">--
    		<input id="createDateEnd" name="createDateEnd" type="text" class="easyui-datebox">
        </div> -->
        
        <div class="form-item form-item">
        	<label for="deptId"></label>
    		<a href="javascript:XF.Notice.listNoticeSearch()" class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
        </div>
        
    </form>

    <table id="noticeListTable" class="easyui-datagrid"  title="" >
        <thead>
    		<tr>
    			<sec:authorize ifAnyGranted="EDIT_NOTICE,DELETE_NOTICE">
    				<th data-options="field:'select',width:80,align:'center',checkbox:'true'"><input type="checkbox"></th>
    			</sec:authorize>
    			<th data-options="field:'siteId',width:360" orderByField='title' >
					<a class="order-field" href="javascript:XF.Notice.listNoticeSearch('title')" >标题</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("title".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span><%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span><%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span><%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span><%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
				<th data-options="field:'viceTitle',width:300" orderByField='viceTitle' >
					<a class="order-field" href="javascript:XF.Notice.listNoticeSearch('viceTitle')" >副标题</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("viceTitle".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span><%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span><%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span><%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span><%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			<th data-options="field:'deptId',width:100" orderByField='deptId' >
					<a class="order-field" href="javascript:XF.Notice.listNoticeSearch('deptId')" >发布部门</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("deptId".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span><%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span><%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span><%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span><%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			<th data-options="field:'enabled',width:100" orderByField='publicMan' >
					<a class="order-field" href="javascript:XF.Notice.listNoticeSearch('publicMan')" >发布人</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("publicMan".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span><%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span><%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span><%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span><%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			
    			
 				<th data-options="field:'publicTime',width:140" orderByField='publicTime' >
					<a class="order-field" href="javascript:XF.Notice.listNoticeSearch('publicTime')" >发布时间</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("publicTime".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span><%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span><%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span><%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span><%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
				<sec:authorize ifAnyGranted="EDIT_NOTICE,DELETE_NOTICE">
					<th data-options="field:'opr',width:100">操作</th>
				</sec:authorize>
    		</tr>
        </thead>
        <tbody>
        	<%
        		if(!CollectionUtils.isEmpty(list)){
        			for(TblOaNotice notice:list){
        				%>
       					 <tr s="<%=EncrypTool.encode(notice.getNoticeId()+"") %>">
       					 	<sec:authorize ifAnyGranted="EDIT_NOTICE,DELETE_NOTICE">
       					 		<td></td>
       					 	</sec:authorize>
       					 	<td>
       					 		<i s="<%=EncrypTool.encode(notice.getNoticeId()+"")%>"></i>
       					 		<a title="<%=notice.getTitle() %>" href="javascript:XF.Notice.detail('<%=EncrypTool.encode(notice.getNoticeId()+"")%>','<%=title %>','<%=form.getPageNum()%>','<%=group%>')">
       					 									<p><%=notice.getIstop().equals("1")?"<span style='color: red;'>[置顶]</span> ":"" %><%=notice.getIsimportant().equals("1")?"<span style='color: red;'>[重要]</span> ":"" %><%=StringUtils.isNotBlank(notice.getTitle())?notice.getTitle():""%></p>
       					 		</a>
       					 	</td>
       					 	<td><%=(null!=notice.getViceTitle())?notice.getViceTitle()+"":"" %></td>
       					 	<td><%=(null!=notice.getPublicDepart())?notice.getPublicDepart()+"":"" %></td>
       					 	<td><%=StringUtils.isNotBlank(notice.getPublicMan())?notice.getPublicMan():"" %></td>
       					 	<td><%=null!=notice.getPublicTime()?DateFormatUtils.format(notice.getPublicTime().getTime(), "yyyy-MM-dd HH:mm:ss"):"" %></td>
			    			
			    			<sec:authorize ifAnyGranted="EDIT_NOTICE,DELETE_NOTICE">
				    			<td>
				    				<sec:authorize ifAllGranted="EDIT_NOTICE">
										<a class="inLink" href="javascript:XF.Notice.editNotice('<%=EncrypTool.encode(notice.getNoticeId()+"")%>','<%=group%>')"><span>编辑</span></a>
									</sec:authorize>
									
									<sec:authorize ifAllGranted="DELETE_NOTICE">
										<a href="javascript:XF.Notice.deleteNotice('<%=EncrypTool.encode(notice.getNoticeId()+"")%>')"><span>删除</span></a>
									</sec:authorize>
				    			</td>
			    			</sec:authorize>
			    		</tr>
        				<%
        			}
        		}
        	%>
    	</tbody>
    </table>
    <div class="pagination paginationFixWidth">
		<monggoTag:pagination 
		href="notice_search_manage"
		pageSize="<%=form.getPageSize()%>" 
		totalRecord="<%=form.getTotalRecord() %>" 
		currentPage="<%=form.getPageNum() %>">
		</monggoTag:pagination> 
	</div>
</div>
<script>
	$('#noticeListTable').datagrid();  
	//XF.Notice.initList();
</script>





























